from sklearn.tree import DecisionTreeClassifier
import pickle
import matplotlib as plt
import numpy as np
import pandas as pd
# 加载数据集并训练-------------------
with open("enddata_x", "rb") as f:
    X = pickle.load(f)
with open("enddata_y", 'rb') as f:
    Y = pickle.load(f)
X = X.T
Y = Y.T
Y = Y.reshape(331461)
print(X.shape)
print(Y.shape)
x1 = np.asarray([30, 40, 54, 65, 74, 88, 10, 54, 21, 64, 51, 24, 20, 54])
tree = DecisionTreeClassifier(criterion='gini', splitter='best')
tree.fit(X, Y.astype('int'))
y_1 = tree.predict(x1.reshape(1, 14))
print(y_1.shape)
print(y_1)
